3.1.47 \(\int \csc ^3(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\) [47]

Optimal. Leaf size=82 \[ -\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]

[Out]

-1/2*a*(a+4*b)*arctanh(cos(f*x+e))/f+1/2*a*(a+4*b)*sec(f*x+e)/f-1/2*a^2*csc(f*x+e)^2*sec(f*x+e)/f+1/3*b^2*sec(
f*x+e)^3/f

________________________________________________________________________________________

Rubi [A]
time = 0.08, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3745, 474, 470, 327, 213} \begin {gather*} -\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-1/2*(a*(a + 4*b)*ArcTanh[Cos[e + f*x]])/f + (a*(a + 4*b)*Sec[e + f*x])/(2*f) - (a^2*Csc[e + f*x]^2*Sec[e + f*
x])/(2*f) + (b^2*Sec[e + f*x]^3)/(3*f)

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 470

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p + 1) + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m +
 n*(p + 1) + 1)), Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c - a*d, 0]
 && NeQ[m + n*(p + 1) + 1, 0]

Rule 474

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^2, x_Symbol] :> Simp[(-(b*c - a*
d)^2)*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*b^2*e*n*(p + 1))), x] + Dist[1/(a*b^2*n*(p + 1)), Int[(e*x)^m*(a +
 b*x^n)^(p + 1)*Simp[(b*c - a*d)^2*(m + 1) + b^2*c^2*n*(p + 1) + a*b*d^2*n*(p + 1)*x^n, x], x], x] /; FreeQ[{a
, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1]

Rule 3745

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[(-1 + ff^2*x^2)^((m - 1)/2)*((a - b + b*ff^2*x^2)^p/x^(m
 + 1)), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {x^2 \left (a-b+b x^2\right )^2}{\left (-1+x^2\right )^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {\text {Subst}\left (\int \frac {x^2 \left (a^2+4 a b-2 b^2+2 b^2 x^2\right )}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}+\frac {(a (a+4 b)) \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}+\frac {(a (a+4 b)) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{2 f}\\ &=-\frac {a (a+4 b) \tanh ^{-1}(\cos (e+f x))}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(231\) vs. \(2(82)=164\).
time = 5.46, size = 231, normalized size = 2.82 \begin {gather*} \frac {\left (24 a b+8 b^2+24 a b \cos (2 (e+f x))-12 a b \cos (3 (e+f x))-b^2 \cos (3 (e+f x))-12 a^2 \cos ^2(e+f x) \cot ^2(e+f x)-3 a^2 \cos (3 (e+f x)) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )-12 a b \cos (3 (e+f x)) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )+3 a^2 \cos (3 (e+f x)) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )+12 a b \cos (3 (e+f x)) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )-3 \cos (e+f x) \left (b (12 a+b)+3 a (a+4 b) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )-3 a (a+4 b) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )\right ) \sec ^3(e+f x)}{24 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

((24*a*b + 8*b^2 + 24*a*b*Cos[2*(e + f*x)] - 12*a*b*Cos[3*(e + f*x)] - b^2*Cos[3*(e + f*x)] - 12*a^2*Cos[e + f
*x]^2*Cot[e + f*x]^2 - 3*a^2*Cos[3*(e + f*x)]*Log[Cos[(e + f*x)/2]] - 12*a*b*Cos[3*(e + f*x)]*Log[Cos[(e + f*x
)/2]] + 3*a^2*Cos[3*(e + f*x)]*Log[Sin[(e + f*x)/2]] + 12*a*b*Cos[3*(e + f*x)]*Log[Sin[(e + f*x)/2]] - 3*Cos[e
 + f*x]*(b*(12*a + b) + 3*a*(a + 4*b)*Log[Cos[(e + f*x)/2]] - 3*a*(a + 4*b)*Log[Sin[(e + f*x)/2]]))*Sec[e + f*
x]^3)/(24*f)

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 85, normalized size = 1.04

method result size
derivativedivides \(\frac {\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(85\)
default \(\frac {\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(85\)
risch \(\frac {3 a^{2} {\mathrm e}^{9 i \left (f x +e \right )}+12 a b \,{\mathrm e}^{9 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{7 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{7 i \left (f x +e \right )}+18 a^{2} {\mathrm e}^{5 i \left (f x +e \right )}-24 a b \,{\mathrm e}^{5 i \left (f x +e \right )}-16 b^{2} {\mathrm e}^{5 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{3 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{3 i \left (f x +e \right )}+3 a^{2} {\mathrm e}^{i \left (f x +e \right )}+12 a b \,{\mathrm e}^{i \left (f x +e \right )}}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{2 f}-\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{2 f}+\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{f}\) \(263\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(1/3*b^2/cos(f*x+e)^3+2*a*b*(1/cos(f*x+e)+ln(csc(f*x+e)-cot(f*x+e)))+a^2*(-1/2*csc(f*x+e)*cot(f*x+e)+1/2*l
n(csc(f*x+e)-cot(f*x+e))))

________________________________________________________________________________________

Maxima [A]
time = 0.30, size = 117, normalized size = 1.43 \begin {gather*} -\frac {3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (3 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}\right )}}{\cos \left (f x + e\right )^{5} - \cos \left (f x + e\right )^{3}}}{12 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/12*(3*(a^2 + 4*a*b)*log(cos(f*x + e) + 1) - 3*(a^2 + 4*a*b)*log(cos(f*x + e) - 1) - 2*(3*(a^2 + 4*a*b)*cos(
f*x + e)^4 - 2*(6*a*b - b^2)*cos(f*x + e)^2 - 2*b^2)/(cos(f*x + e)^5 - cos(f*x + e)^3))/f

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 178 vs. \(2 (79) = 158\).
time = 3.45, size = 178, normalized size = 2.17 \begin {gather*} \frac {6 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 4 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, b^{2} - 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right )}{12 \, {\left (f \cos \left (f x + e\right )^{5} - f \cos \left (f x + e\right )^{3}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/12*(6*(a^2 + 4*a*b)*cos(f*x + e)^4 - 4*(6*a*b - b^2)*cos(f*x + e)^2 - 4*b^2 - 3*((a^2 + 4*a*b)*cos(f*x + e)^
5 - (a^2 + 4*a*b)*cos(f*x + e)^3)*log(1/2*cos(f*x + e) + 1/2) + 3*((a^2 + 4*a*b)*cos(f*x + e)^5 - (a^2 + 4*a*b
)*cos(f*x + e)^3)*log(-1/2*cos(f*x + e) + 1/2))/(f*cos(f*x + e)^5 - f*cos(f*x + e)^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \csc ^{3}{\left (e + f x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)**3*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Integral((a + b*tan(e + f*x)**2)**2*csc(e + f*x)**3, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (79) = 158\).
time = 0.84, size = 254, normalized size = 3.10 \begin {gather*} -\frac {\frac {3 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - 6 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - \frac {3 \, {\left (a^{2} - \frac {2 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}{\cos \left (f x + e\right ) - 1} - \frac {16 \, {\left (6 \, a b + b^{2} + \frac {12 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {6 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {3 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1\right )}^{3}}}{24 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

-1/24*(3*a^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 6*(a^2 + 4*a*b)*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x +
e) + 1)) - 3*(a^2 - 2*a^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 8*a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1))
*(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - 16*(6*a*b + b^2 + 12*a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 6*a*
b*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 + 3*b^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)/((cos(f*x + e)
- 1)/(cos(f*x + e) + 1) + 1)^3)/f

________________________________________________________________________________________

Mupad [B]
time = 12.61, size = 188, normalized size = 2.29 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (\frac {a^2}{2}+2\,b\,a\right )}{f}+\frac {a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2}{8\,f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (\frac {3\,a^2}{2}+32\,b\,a\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\,\left (\frac {a^2}{2}+16\,a\,b+8\,b^2\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {3\,a^2}{2}+16\,a\,b+\frac {8\,b^2}{3}\right )+\frac {a^2}{2}}{f\,\left (-4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8+12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6-12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(e + f*x)^2)^2/sin(e + f*x)^3,x)

[Out]

(log(tan(e/2 + (f*x)/2))*(2*a*b + a^2/2))/f + (a^2*tan(e/2 + (f*x)/2)^2)/(8*f) - (tan(e/2 + (f*x)/2)^4*(32*a*b
 + (3*a^2)/2) - tan(e/2 + (f*x)/2)^6*(16*a*b + a^2/2 + 8*b^2) - tan(e/2 + (f*x)/2)^2*(16*a*b + (3*a^2)/2 + (8*
b^2)/3) + a^2/2)/(f*(4*tan(e/2 + (f*x)/2)^2 - 12*tan(e/2 + (f*x)/2)^4 + 12*tan(e/2 + (f*x)/2)^6 - 4*tan(e/2 +
(f*x)/2)^8))

________________________________________________________________________________________